package com.sjm.bookshop.utils;

import lombok.Data;

@Data
public class Result {
    private String msg;
    private int status;
    private Object data;
    private String token;


    //    成功有结果集
    private Result(int status, Object data, String msg, String token) {
        this.msg = msg;
        this.data = data;
        this.status = status;
        this.token = token;
    }

    public static Result success(int status, Object data, String msg, String token) {
        return new Result(status, data, msg, token);
    }

    //失败无结果集
    private Result(int status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public static Result fail(int status, String msg) {
        return new Result(status, msg);
    }

    //成功无结果集
    public static Result success(int status, String msg) {
        return new Result(status, msg);
    }

    //    成功有结果集
    private Result(int status, Object data, String msg) {
        this.msg = msg;
        this.data = data;
        this.status = status;

    }

    public static Result success(int status, Object data, String msg) {
        return new Result(status, data, msg);
    }


}
